Skip to main content

Visualization Element: Button

Symbol:

_visu_img_button.png

Category: Common Controls

The element triggers an action, such as setting a variable.

Element properties

Are all element properties available?

All properties are available only after you select the Advanced option or the All categories filter in Properties.

Element name

Example: Voltage_on

Tip

Assign individual names for elements so that they are found faster in the element list.

Element Type

Button

Position

The position defines the location and size of the element in the visualization window. This is based on the Cartesian coordinate system. The origin is located in the upper left corner of the window. The positive horizontal X-axis runs to the right. The positive vertical Y-axis runs downwards.

X

The X-coordinate (in pixels) of the upper left corner of the element

Example: 10

Y

The Y-coordinate (in pixels) of the upper left corner of the element

Example: 10

Width

Specified in pixels

Example: 150

Height

Specified in pixels

Example: 30

Tip

You can also change the values by dragging the box _visu_icon_position_element.png symbols to other positions in the editor.

Center

The properties contain fixed values for the coordinates of the point of rotation. The rotation point is displayed in the editor as the _visu_icon_center_point.png symbol and is used as the center for rotation and scaling.

Tip

You can also change the values by dragging the _visu_icon_center_point.png symbol to another position in the editor.

X

X-coordinate of the point of rotation

Y

Y-coordinate of the point of rotation

Colors

The properties contain fixed values for setting colors.

Color

Color for the element in its normal state

Note

Note: The alarm state is in effect if the expression in the Color variables → Toggle color property has the value FALSE.

Alarm color

Color for the element in alarm state

Note

Note: The alarm state is in effect if the expression in the Color variables → Toggle color property has the value TRUE.

Transparency

Value (0 to 255) for defining the transparency of the selected color

255: The color is opaque.

0: The color is completely transparent.

Note

If the color is a style color and already has a transparency value, then this property is write-protected.

Use gradient color

standard icon: The element is displayed with a color gradient.

Gradient setting

The Gradient Editor dialog opens.

Image

Static ID

Reference to the image of an image pool according to the following the scheme:

<name of image pool>.<image ID>

Example: Imagepool.GreenButton

If the image is from the GlobalImagePool, then you can omit the name of the image pool because this pool is automatically searched first.

_cds_icon_three_dots.png: The Input Assistant dialog opens and lists all available image pools and images in the entire project.

Scale type

. Behavior of the image when resizing the button.
  • Isotropic: The image retains its proportions. The ratio of height to width is retained, even if you change the height or width of the button separately.

  • Anisotropic: The image resizes to the dimensions of the button.

  • Fixed: The image retains its original size, even if you resize the button.

Transparency

The visualization displays the image with the transparency color that is selected in Transparency color.

Transparent color

Requirement: The Transparency option is selected.

Color which is transparently in the image

Example: White

If the image background that is reference by Static ID is white, then this background is displayed transparent.

Clicking _cds_icon_three_dots.png opens a color picker dialog.

Horizontal alignment

. Horizontal alignment of the image
  • Left

  • Centered

  • Right

Vertical alignment

. Vertical alignment of the image
  • Top

  • Centered

  • Bottom

Texts

Text

String (without single straight quotation marks)

Example: Accesses: %i

The element is labeled with this text. If a placeholder %<format string> is specified in the text, then the value of the variable in the Text variable → Text property is output at the location of the placeholder.

Tooltip

String (without single straight quotation marks)

Example: Number of valid accesses %n

The text is output as a tooltip. If a placeholder %<format string> is specified in the text, then the value of the variable in the Text variable → Tooltip property is output at the location of the placeholder.

Tip

Use the Ctrl+Enter shortcut to add a line break.

Tip

The specified texts are automatically transferred to the GlobalTextList text list. Therefore, these texts can be localized.

Text properties

The properties get fixed values for the text properties and act on the texts configured in Texts → Text or Texts → Tooltip.

Horizontal alignment

Horizontal alignment of the text within the element

Vertical alignment

Vertical alignment of the text within the element

Text format

. Definition for displaying texts that are too long
  • Default: The text which is too long is truncated.

  • Line break: The text is split into lines.

  • Ellipsis: The visible text ends with "..." indicating that it is not complete.

Font

Example: Default

_cds_icon_three_dots.png: The Font dialog opens.

_cds_icon_arrow_down.png: List box with style fonts

Font color

Font color in the normal state

Example: Black

_cds_icon_three_dots.png: The Color dialog opens.

_cds_icon_arrow_down.png: List box with style colors

Font alarm color

Font color which is active in the alarm state

Important

It must differ from the font color in the normal state.

Example: Red

Transparency

Integer (value range from 0 to 255)

The transparent value determines the transparency of the respective color.

255: The color is opaque.

0: The color is completely transparent.

Note

If the color is a style color and already has a transparency value, then this property is write-protected.

Absolute movement

The properties contain IEC variables for controlling the position of the element dynamically. The reference point is the upper left corner of the element. At runtime, the entire element is moved.

Movement

X

  • Variable (numeric data type) for the X-position (in pixels)

    Example: PLC_PRG.iPos_X.

Increasing this value at runtime moves the element to the right.

Y

Increasing this value at runtime moves the element downwards.

Rotation

Variable (numeric data type) for the angle of rotation (in degrees)

Example: PLC_PRG.iAngle1.

The midpoint of the element rotates at the Center point. This rotation point is shown as the _visu_icon_center_point.png symbol.

At runtime, the alignment of the element remains the same with respect to the coordinate system of the visualization. Increasing the value rotates the element to the right.

_visu_img_prp_rotation.png

Scaling

Variable (integer data type) to trigger a centric stretching

Example: PLC_PRG.iScaling.

The reference point is the Center property.

The value 1 shrinks the element by a factor of 0.001. The value 1000 returns the element to its original size.

Tip

You can combine the variables to a Unit conversion.

Tip

The X, Y, Rotation, and Interior rotation properties are supported by the "Client Animation" functionality.

Relative movement

The properties contains variables for moving the element. The reference point is the position of the element (Position property). The shape of the element can change.

Movement top-left

X

  • Variable (integer data type) for the number (in pixels) which the left edge is moved horizontally

    Example: PLC_PRG.iDeltaX

Incrementing the value moves the element to the right.

Y

  • Variable (integer data type)for the number (in pixels) which the top edge is moved vertically

    Example: PLC_PRG.iDeltaY

Incrementing the value moves the element to the down.

Movement bottom-right

X

  • Variable (integer data type) for the number (in pixels) which the right edge is moved horizontally.

    Example: PLC_PRG.iDeltaWidth

  • Container variable: Container.Width

    For more information, see: Optimally Adjusting the Position and Size

Incrementing the value moves the element to the right.

Y

  • Variable (integer data type)for the number (in pixels) which the bottom edge is moved vertically

    Example: PLC_PRG.iDeltaHeight

  • Container variable: Container.Height

    For more information, see: Optimally Adjusting the Position and Size

Incrementing the value moves the element to the down.

Text variables

Text variable

Variable (data type conforming to the formatting specification) for the placeholder in the Texts → Text property

Example: PLC_PRG.iAccesses

The variable value replaces the placeholder in the text of the element. At runtime, the element is labeled with the text, and the variable value is constantly updated.

Note

If you specify a variable of type enumeration with text list support, then the name of the enumeration data type is added automatically in angle brackets after the variable name. Example: PLC_PRG.enVar <enumeration name>. Then the symbolic value of the enumeration component is printed instead of the numeric value when text is printed. See the help page for enumerations.

Tooltip variable

Variable (data type conforming to the formatting specification) for the placeholder in the Texts → Tooltip property

Example: PLC_PRG.iAccessesInTooltip

The variable value replaces the placeholder in the tooltip of the element. At runtime, the tooltip is displayed and the variable value is constantly updated.

Dynamic texts

Dynamic texts are variably indexed texts of a text list. At runtime, the text is displayed that is currently indexed in the variable.

Text List

. Name of the text list
  • As a variable (STRING)

  • As fixed string literal with single straight quotation marks

    Example: 'Errorlist'

_cds_icon_arrow_down.png: List box with the dialogs available in the text lists

Note: If a text list from the project is transferred to a visualization in a library, then a dot has to be prepended to the name of the text list.

Text index

. Text list ID which refers to the desired output text
  • As fixed string with the ID in single straight quotation marks

    Example: '1'

  • As a variable (STRING) for dynamically controlling the text output

    Example: strTextID

    Sample assignment: PLC_PRG.strTextID := '1';

Tooltip index

. Text list ID which refers to the desired output text
  • As fixed string with the ID in single straight quotation marks

    Example: '2'

  • As a variable (STRING) for dynamically controlling the text output

    Example: strToolTipID

    Sample assignment: PLC_PRG.strToolTipID := '2';

Font variables

The variables allow for dynamic control of the text display.

Font name

Variable (STRING) for the font of the text

Example: PLC_PRG.stFontVar := 'Arial';

Tip

You can find out which fonts are available in the standard Font dialog.

Size

Variable (numeric data type) for the font size (in pixels or points)

The applied unit is specified in brackets after the variable name.

  • <pt>: Points (default)

    Example: PLC_PRG.iFontHeight <pt>

    Code: iFontHeight : INT := 12;

  • <px>: Pixels

    Example: PLC_PRG.iFontHeight <px>

    Code: iFontHeight : INT := 19;

Tip

The font size is specified in points (example: Arial 12). Use points when the variable font size should match a font, for example if a font is set in the Text property → Font property.

Tip

If you click in the value field, a _cds_img_dropdownlist_unit_font_size.png list box opens on the right for setting the unit.

Flags

Variable (DWORD) for the flags to determine the font display

. Flags:
  • 1: Italics

  • 2: Bold

  • 4: Underline

  • 8: Strikethrough

Note

You can combine the font displays by adding the coding of the flags. For example, a bold and underlined text: PLC_PRG.dwFontType := 6;

Font

Variable (DWORD) for the character set number of the font

The selection of character set numbers corresponds to the Script setting of the standard Font dialog.

Color

Variable (DWORD) for the color of the text

Example: PLC_PRG.dwColorFont:= 16#FF000000;

Alarm color

Variable (DWORD) for the text color during an alarm

Important

This color overwrites the static font alarm color (in the property: Text propertiesFont alarm color)

It must differ from the font color in the normal state.

Flags for text alignment

Variable (integer data type) for coding the text alignment

Example: PLC_PRG.dwTextAlignment

. Coding:
  • 0: Top left

  • 1: Horizontal center

  • 2: Right

  • 4: Vertical center

  • 8: Bottom

Note

You can combine the text alignments by adding the coding of the flags. For example, a vertical and horizontal centered text: PLC_PRG.dwFontType := 5;

Tip

Fixed values for displaying texts are set in Text properties.

Color variables

The Element property is used as an interface for project variables to dynamically control colors at runtime.

Toggle color

Variable (BOOL) for the color toggling

. Value assignment:
  • FALSE: The element is displayed with the color specified in the Color property.

  • TRUE: The element is displayed with the color specified in the Alarm color property.

. Assigning the property:
  • Placeholder for the user input variable of the input configuration

    • <toggle/tap variable>

    • <NOT toggle/tap variable>

    The color change is not controlled by its own variable, but by a user input variable.

    Note

    Specify a variable for the mouse events Tap or Toggle in the input configuration. Only then is the placeholder set. If you configure a variable in both Toggle and Tap, then the variable specified in Tap is used.

    Tip

    Click the _visu_icon_linked_variable.png symbol to insert the <toggle/tap variable> placeholder.

    Then when you activate the Input configuration, Tap FALSE property, the <NOT toggle/tap variable> placeholder is displayed.

  • Instance path of a project variable (BOOL)

    Example: PLC_PRG.xColorIsToggeled

    Note

    In the code, declare and implement the variable which is specified here whose value assignment determines when the color changes.

Color

Color variable for the frame

  • Variable (DWORD) for the color

    Example: PLC_PRG.dwColor

  • Color literal

    Example of gray and opaque: 16#FF888888

Requirement: Show frame property is activated.

Note

The normal state is in effect if the expression in the Color variables → Toggle color property is not defined or it has the value FALSE.

Alarm color

Color variable for the frame in alarm state

  • Variable (DWORD) for the alarm color

    Example: PLC_PRG.dwAlarmColor

  • Color literal

    Example of red and opaque: 16#FFFF0000

Note

The alarm state is in effect if the expression in the Color variables → Toggle color property has the value TRUE.

Tip

The transparency part of the color value is evaluated only if the Visualization ManagerActivate semi-transparent drawing option of the visualization manager is selected.

Tip

In the toolbar of the Properties, select the Advanced option. Then all element properties are visible.

Blinking

The value in Blink interval specifies the interval in milliseconds (ms) in which the element switches its color between the normal state and the alarm state.

Requirement: The visualization is run as WebVisu and the Support client animations and overlay of native elements option in the Visualization Manager is enabled. The element can blink only in this context.

For more information, see: Group: General Settings

Blink interval

Blink interval in milliseconds (ms) for the normal color and alarm color as defined under the Colors element property

At 0 (default setting), the element does not blink. The element is simply displayed in the normal color.

  • Variable (type UDINT) for a program-controlled color change of color

    Example: PLC_PRG.udiBlinking

  • Literal (type UDINT) which causes the color to change after a fixed time interval.

    Example: 1000 for 1 s

State variables

The variables control the element behavior dynamically.

Invisible

Variable (BOOL) for toggling the visibility of the element

TRUE: The element is not visible at runtime.

Example: bIsVisible with VAR bIsVisible : BOOL := FALSE; END_VAR

Deactivate inputs

Variable (BOOL) for toggling the operability of the element

TRUE: User inputs do not have any effect in runtime more. The element is shown as deactivated.

Tip

The Invisible property is supported by the "Client Animation" functionality.

Image ID variable

Image ID

Variable (STRING) for the image ID

Example: PLC_PRG.stImageID

Application code: PLC_PRG.stImageID := 'ImagePool_A.Bild3';

The variable value formally refers to a specific image of an image pool and corresponds to the value in the Static ID property.

Animation

Tip

These properties are available only when you have selected the Support client animations and overlay of native elements option in the Visualization Manager.

Animation duration

Variable for the duration (in milliseconds) in which the element runs an animation

  • Variable (integer value)

    Example: Menu.tContent with VAR tContent : INT := 500; END_VAR

  • Integer literal

    Example: 500

. Animatable properties
  • Absolute movement, Movement, X, Y

  • Absolute movement, Rotation

  • Absolute movement, Interior rotation

  • Absolute movement, Exterior rotation

The animated movement is executed when at least one value of an animatable property has changed. The movement then executed is not jerky, but is smooth within the specified animation duration. The visualization element travels to the specified position while rotating dynamically. The transitions are smooth.

Move to foreground

Variable (BOOL) for setting the element in the foreground

TRUE: At runtime, the visualization element is displayed in the foreground.

FALSE: At runtime, the visualization element is displayed in the layer where it was inserted in the visualization editor.

Example: bIsInForeground with VAR bIsInForeground : BOOL := FALSE; END_VAR

Input Configuration

The properties contain the configurations for the user input when using the mouse or keyboard. A user input defines an event and one or more actions that are executed when an event occurs.

Tip

The Configure button opens the Input Configuration dialog. There you can create or edit user inputs.

Configured user inputs are listed below the events. They each include the action that is triggered and the setting in short form.

Example: Execute ST Code: _visu_icon_action.png PLC_PRG.i_x := 0;

OnDialogClosed

Input event: The user closes the dialog.

OnMouseClick

Input event: The user clicks the mouse button completely in the element area. The mouse button is clicked and released.

OnMouseDown

Input event: The user clicks down on the mouse button.

OnMouseEnter

Input event: The user drags the mouse pointer to the element.

OnMouseLeave

Input event: The user drags the mouse pointer away from the element.

OnMouseMove

Input event: The user moves the mouse pointer over the element area.

OnMouseUp

. Input events:
  • The user releases the mouse button within the element area. It is irrelevant whether the user has previously pressed the mouse button inside or outside the element area.

  • The user presses the mouse button within the element area, leaves the element area, and then releases the mouse button.

Note

This CODESYS-specific triggering behavior guarantees that actions for key elements are completed. A key element starts an action for OnMouseDown and ends the action for OnMouseUp.

Example: A visualization user presses the mouse button within the element area of the key element and then moves the cursor position so that it is located outside of the element area. The action is ended anyway because OnMouseUp is triggered.

OnValueChanged

Event which triggers follow-up actions due to a change in value

Which follow-up actions are triggered is configured in the Input Configuration dialog.

The defined follow-up actions and the corresponding configuration are displayed below the element property.

The OnValueChanged event can be disabled by the VISU_NO_VALUECHANGED compiler define in the properties dialog of the application.

Tap

When a mouse click event occurs, the variable defined in Variable is described in the application. The coding depends on the Tap FALSE and Tap on enter if captured options.

Variable

Requirement: The Tap FALSE option is not activated.

Variable (BOOL) for the mouse click event

TRUE: A mouse click event exists. It lasts as long as the user presses the mouse button over the element. It ends when the button is released.

FALSE: A mouse click event does not exist.

Example: PLC_PRG.bIsTapped

Tap FALSE

standard icon: The mouse click event leads to a complementary value in Variable.

TRUE: A mouse click event does not exist.

FALSE: While the mouse click event exists.

Tap on enter if captured

standard icon: During user input, it is also taken into consideration whether the mouse pointer is dragged within the element area or not while the mouse button is pressed.

TRUE: While the mouse click event exists and the mouse pointer is moved over the element area.

FALSE: A mouse click event does not exist. Or the user moves the mouse pointer outside of the element area while the mouse button is pressed.

The value is TRUE again as soon as the user moves the pointer back to the element area. The mouse is then captured.

Switch over

With the onset of a mouse click event, the variable is set; when the mouse click event is completed, the variable is reset.

Variable

Variable (BOOL) for toggling at the end of the mouse click event

This is when the user releases the mouse button while the mouse pointer is over the element area. If the user releases the mouse button while the mouse pointer is outside of the element area, then the mouse click event is not ended and the value is not toggled.

Tip

The user can cancel a started toggle input by dragging the mouse pointer out of the element area.

Toggle on up if captured

standard icon: The value toggles regardless of where the mouse pointer is when the mouse button is released. The mouse is then captured.

Hotkey

Shortcut on the element for triggering specific input actions

When the hotkey event occurs, the input actions in the Events property are triggered. In this way, it is not the input action itself that leads to this input action, but the mouse input action.

Key

Key pressed for input action.

Example: T

The following properties appear when a key is selected.

Events

  • None

  • Mouse down: Pressing the key triggers the input actions that are configured in the OnMouseDown property.

  • Mouse up: Releasing the key triggers the input actions that are configured in the OnMouseUp property.

  • Mouse down/up: Pressing and releasing the key triggers the input actions that are configured in the OnMouseDown property and the OnMouseUp property.

Switch over

standard icon: Combination with the "Shift" key

Example: Shift+T.

Control

standard icon: Combination with the "Ctrl" key

Example: Ctrl+T.

Alt

standard icon: Combination with the "Alt" key

Example: Alt+T.

Tip

All keyboard shortcuts and their actions that are configured in the visualization are listed on the Keyboard Configuration tab.

Access Rights

Note

Available only when a user management is set up for visualization.

Access Rights button

Opens the Access Rights dialog. There you can edit the access privileges for the element.

. Status messages:
  • Not set. Full rights.: Access rights for all user groups : operable

  • Rights are set: Limited rights: Access is restricted for at least one group.